/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
double n, p1, v1, p2, v2;
const double esp = 1e-8;

bool judge(double t)
{
    double t1 = p1 / v1;
    double t2 = (n - p2) / v2;
    double x1, x2;
    if (t1 - t > 0.0 || t2 - t > 0.0)
        return true;
    if (t - 2 * t1 > 0.0)
    {
        double temp = t - t1 * 2;
        x1 = temp * v1;
        x1 = max(x1, (t - t1) * v1 / 2);
    }
    else
    {
        x1 = (t - t1) * v1 / 2;
    }
    if (t - 2 * t2 > 0.0)
    {
        double temp = t - t2 * 2;
        x2 = temp * v2;
        x2 = max(x2, (t - t2) * v2 / 2);
    }
    else
    {
        x2 = (t - t2) * v2 / 2;
    }
    if (x1 + x2 > p2 - p1)
        return true;
    else
        return false;
}

int main()
{
    IOS;
    ll t;
    cin >> t;
    while (t--)
    {
        cin >> n >> p1 >> v1 >> p2 >> v2;
        double t1, t2;
        double x;
        if (p1 - p2 > 0.0)
        {
            swap(p1, p2);
            swap(v1, v2);
        }
        //各自走------------------------------------------------
        if (0.0 < n - p1 - p1)
        {
            t1 = (p1 + n) / v1;
        }
        else
            t1 = (n - p1 + n) / v1;
        if (0.0 < n - p2 - p2)
        {
            t2 = (p2 + n) / v2;
        }
        else
            t2 = (n - p2 + n) / v2;
        double ans = min(t1, t2);
        //同时向左------------------------------------------------
        double tt1 = (p1 + p2) / v1;
        double tt2 = (n - p2) / v2;
        double t5;
        tt2 = p2 / v2;
        tt1 = (n - p1) / v1;
        t5 = min(tt1, tt2);
        ans = min(ans, t5);

        double l = 0, r = ans + 100.0;
        // double eps=
        while (r - l > esp)
        {
            double mid = (l + r) / 2;
            if (judge(mid))
            {
                r = mid;
            }
            else
                l = mid;
        }
        ans = min(ans, r);
        printf("%.10f\n", ans);
    }
    getchar();
    getchar();
    return 0;
}
